<?php

declare (strict_types = 1);

namespace app\api\controller;

use think\App;
use think\response\Json;
use app\api\service\Category as CategoryService;

/**
 * 商品分类控制器
 */
class Category extends Controller
{

    private $categoryService;
    public function __construct(App $app,CategoryService $categoryService)
    {
        parent::__construct($app);
        $this->categoryService = $categoryService;
    }

    /**分类
     * @return Json
     */
    public function list():Json
    {
        $params = $this->request->get();
        $this->validate(
            $params,
            [
                //'name|品牌' => ''
            ]
        );
        $list = $this->categoryService->getList($params);
        return $this->renderSuccess($list);
    }

}
